<?php  
	include("../includes/connect_db.php");
	include("../includes/core.php");

	$idresto = $_POST['idresto'];
	$act = $_POST['act'];

	if (!isset($_SESSION['idUser'])) {
		$iduser = 0;
	} else {
		$iduser = $_SESSION['idUser'];
	}

	switch ($act) {
		case '1':
			break;
		
		case '2':
			break;
		
		case '3':
			$sql_delete_resto_menu = "DELETE FROM resto_menu WHERE idresto = '$idresto'";
			if ($query_delete_resto_menu = mysql_query($sql_delete_resto_menu)) {
				echo "sukses";
			} else {
				echo mysql_error();
			}
			break;

		case '4':
			$sql_delete_resto = "DELETE FROM resto WHERE id = '$idresto'";
			$sql_delete_resto_menu = "DELETE FROM resto_menu WHERE idresto = '$idresto'";
			$sql_delete_nota = "DELETE FROM nota WHERE id = '$idresto'";

			if ($query_delete_resto = mysql_query($sql_delete_resto) && $query_delete_resto_menu = mysql_query($sql_delete_resto_menu) && $query_delete_nota = mysql_query($sql_delete_nota)) {
				echo "sukses";
			} else {
				echo mysql_error();
			}
			break;
		default:
			# code...
			break;
	}
?>